package com.zyh.mapper;

import com.zyh.entity.Authority;
import com.zyh.entity.User;
import com.zyh.entity.UserVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface Authoritymapper {
    public List<Authority> selectAuthority(Authority authority);

    public Integer updateAuthorityWithId(Authority  authority);

    @Select("Select * FROM t_authority WHERE roleId=#{roleId}")
    public Authority selectAuthorityByid(Integer id);

    @Insert( "INSERT INTO t_authority (authority,details) " +
            "VALUES (#{authority},#{details})")
    @Options(useGeneratedKeys = true, keyProperty = "roleId", keyColumn = "roleId")
    public Integer addAuthority(Authority authority);

    public Integer DeleteAuthorityByids(Integer[] id);


    public Integer countAuthority(Authority authority);

    @Select("SELECT roleId,authority FROM t_authority")
    public List<Authority> selectAuthorityBywhere(Authority authority);

}
